const { src,dest,watch }=require('gulp');
const less = require('gulp-less');
const connect = require('gulp-connect');
//压缩插件
const htmlClean = require('gulp-htmlclean');
const cssClean = require('gulp-clean-css');
const ugligy = require('gulp-uglify');

const folder = {
    src:'src/',
    dist:'dist/'
}

function development(cb){
    console.log("hello,world!");
    html();
    css();
    js();
    cb();
}
function html(){
    return src(folder.src+'html/*.html')
    .pipe(htmlClean())
    .pipe(dest(folder.dist+'html'))
}
function css(){
    return src(folder.src+'css/*.less')
    .pipe(less())
    .pipe(cssClean())
    .pipe(dest(folder.dist+'css'))
}
function js(){
    return src(folder.src+'js/*.js')
    .pipe(ugligy())
    .pipe(dest(folder.dist+'js'));
}
// 监听器
watch(folder.src+'css/*',function(cb){
    css();
    cb()
})

exports.default=development;